import fetch from 'common/src/utils/fetch'
import { ftruncateSync } from 'fs';
// 查询列表
export function getArrearsStudentList(data = {}) {
    return fetch({
        url: '/api/studentservice/paymentlist/list',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
// 新增
export function getArrearsStudent(data = {}) {
    return fetch({
        url: '/api/studentservice/paymentlist/addPayment',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//删除
export function deleteArrearsStudent(data = []) {
    return fetch({
        url: '/api/studentservice/paymentlist/deletePayment',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
// 获取详情
export function getArrearsStudentDetail(data = {}) {
    return fetch({
        url: `/api/studentservice/paymentlist/paymentDetail?id=${data.studentId}`,
        method: 'get',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
// 导出列表
export function exportArrearsStudentList(data = {}) {
    let keys = Object.keys(data).filter(item => data[item]);
    let params = keys.reduce((prev, curr, index) => {
        prev += curr + '=' + data[curr];
        if (index < keys.length - 1) {
            prev += '&';
        }
        return prev;
    }, '');
    let url = '/api/studentservice/paymentlist/exportPaymentList';
    params && (url += `?${params}`);
    window.open(url);
}
//修改
export function editArrearsStudent(data = {}) {
    return fetch({
        url: '/api/studentservice/paymentlist/updatePayment',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}